<?php

/**
 * This is the model class for table "tbl_resp_ges_files_detalle".
 *
 * The followings are the available columns in table 'tbl_resp_ges_files_detalle':
 * @property integer $rfd_id
 * @property string $rfd_codigo
 * @property string $rfd_nombre
 * @property string $rfd_nombre_encode
 * @property integer $rfd_estado
 */
class tbl_resp_ges_files_detalle extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return tbl_resp_ges_files_detalle the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_resp_ges_files_detalle';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('rfd_codigo, rfd_nombre, rfd_nombre_encode, rfd_estado', 'required'),
			array('rfd_estado', 'numerical', 'integerOnly'=>true),
			array('rfd_codigo', 'length', 'max'=>15),
			array('rfd_nombre', 'length', 'max'=>100),
			array('rfd_nombre_encode', 'length', 'max'=>40),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('rfd_id, rfd_codigo, rfd_nombre, rfd_nombre_encode, rfd_estado', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'rfd_id' => 'Rfd',
			'rfd_codigo' => 'Rfd Codigo',
			'rfd_nombre' => 'Rfd Nombre',
			'rfd_nombre_encode' => 'Rfd Nombre Encode',
			'rfd_estado' => 'Rfd Estado',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('rfd_id',$this->rfd_id);

		$criteria->compare('rfd_codigo',$this->rfd_codigo,true);

		$criteria->compare('rfd_nombre',$this->rfd_nombre,true);

		$criteria->compare('rfd_nombre_encode',$this->rfd_nombre_encode,true);

		$criteria->compare('rfd_estado',$this->rfd_estado);

		return new CActiveDataProvider('tbl_resp_ges_files_detalle', array(
			'criteria'=>$criteria,
		));
	}
}